package com.shsmi.dsn.service.Impl;

import com.shsmi.dsn.dao.DsnTaskRepository;
import com.shsmi.dsn.domain.DsnTask;
import com.shsmi.dsn.service.TaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

@Service
public class TaskServiceImpl implements TaskService {
    @Autowired
    private DsnTaskRepository repository;

    @Override
    public Page<DsnTask> listAll(Example<DsnTask> example, Pageable pageable) {
        return repository.findAll(example, pageable);
    }

    @Override
    public DsnTask getById(Long id) {
        return repository.findById(id).get();
    }

    @Override
    public DsnTask insert(DsnTask record) {
        return repository.save(record);
    }

    @Override
    public DsnTask update(DsnTask record) {
        return repository.save(record);
    }

    @Override
    public void delete(Long id) {
        repository.deleteById(id);
    }
}
